import unittest, requests

class Wdjk(unittest.TestCase):

    def setUp(self) -> None:
        print('开始测试')

    def tearDown(self) -> None:
        print('结束测试')

    # 医生相关接口
    # 登录
    case_hj = 'http://10.59.9.18/'
    # 医生id
    doctorId = None
    # 医生登陆凭证
    sessionId = None
    def test_wdjk_01(self):
        r1 = requests.post(url=Wdjk.case_hj+'health/doctor/v1/login',
                           params={'email':'2306398720@qq.com', 'pwd':'lZjdXyj15cOhn1a0yJKsW7o+fw/ogBDzn6CcyPSJUVIMmCPtCs+zuPwh7IZkXZiRhJvvjdIz9D2z1jkMOtD/36ddaLFMtQd9xIk0jAaDP1TH/lEHvvUPwot6asMGMGkH9EgBPT+4eaYC77BGQBPOASweQZE5KDF8BeN/c0sLfSw='})
        print(r1.json())
        Wdjk.doctorId = r1.json()['result']['doctorId']
        print(Wdjk.doctorId)
        Wdjk.sessionId = r1.json()['result']['sessionId']
        print(Wdjk.sessionId)

    # 查询医生的问诊记录列表
    # 聊天记录id
    recordId = None
    def test_wdjk_02(self):
        r2 = requests.get(url=Wdjk.case_hj+'health/doctor/inquiry/verify/v1/findInquiryRecordList',
                          headers={'doctorId':str(Wdjk.doctorId),'sessionId':str(Wdjk.sessionId)})
        print(r2.json())

    # 查询问诊聊天记录
    def test_wdjk_03(self):
        r3 = requests.get(url=Wdjk.case_hj+'health/doctor/inquiry/verify/v1/findInquiryDetailsList',
                          headers={'doctorId':str(Wdjk.doctorId),'sessionId':str(Wdjk.sessionId)},
                          params={'recordId':str(Wdjk.recordId),'page':1,'count':5})
        print(r3.json())

    # 查询医生历史问诊记录列表
    def test_wdjk_04(self):
        r4 = requests.get(url=Wdjk.case_hj+'health/doctor/inquiry/verify/v1/findHistoryInquiryRecord',
                          headers={'doctorId':str(Wdjk.doctorId),'sessionId':str(Wdjk.sessionId)},
                          params={'page':1,'count':5})
        print(r4.json())

    # 结束问诊
    def test_wdjk_05(self):
        r5 = requests.put(url=Wdjk.case_hj+'health/doctor/inquiry/verify/v1/endInquiry',
                          headers={'doctorId':str(Wdjk.doctorId),'sessionId':str(Wdjk.sessionId)},
                          params={'recordId': str(Wdjk.recordId)})
        print(r5.json())

    # 单接口功能测试用例1
    def test_wdjk_06(self):
        r1 = requests.post(url=Wdjk.case_hj+'health/doctor/v1/login',
                           params={'email':'2306398720@qq.com', 'pwd':'lZjdXyj15cOhn1a0yJKsW7o+fw/ogBDzn6CcyPSJUVIMmCPtCs+zuPwh7IZkXZiRhJvvjdIz9D2z1jkMOtD/36ddaLFMtQd9xIk0jAaDP1TH/lEHvvUPwot6asMGMGkH9EgBPT+4eaYC77BGQBPOASweQZE5KDF8BeN/c0sLfSw='})
        print(r1.json())

    def test_wdjk_07(self):
        r1 = requests.post(url=Wdjk.case_hj+'health/doctor/v1/login',
                           params={'email':'2106398720@qq.com', 'pwd':'lZjdXyj15cOhn1a0yJKsW7o+fw/ogBDzn6CcyPSJUVIMmCPtCs+zuPwh7IZkXZiRhJvvjdIz9D2z1jkMOtD/36ddaLFMtQd9xIk0jAaDP1TH/lEHvvUPwot6asMGMGkH9EgBPT+4eaYC77BGQBPOASweQZE5KDF8BeN/c0sLfSw='})
        print(r1.json())

    def test_wdjk_08(self):
        r1 = requests.post(url=Wdjk.case_hj+'health/doctor/v1/login',
                           params={'email':'2306398720@qq.com', 'pwd':'lZjdXy215cOhn1a0yJKsW7o+fw/ogBDzn6CcyPSJUVIMmCPtCs+zuPwh7IZkXZiRhJvvjdIz9D2z1jkMOtD/36ddaLFMtQd9xIk0jAaDP1TH/lEHvvUPwot6asMGMGkH9EgBPT+4eaYC77BGQBPOASweQZE5KDF8BeN/c0sLfSw='})
        print(r1.json())

    @unittest.skip
    def test_wdjk_09(self):
        r1 = requests.post(url=Wdjk.case_hj+'health/doctor/v1/login',
                           params={'pwd':'lZjdXyj15cOhn1a0yJKsW7o+fw/ogBDzn6CcyPSJUVIMmCPtCs+zuPwh7IZkXZiRhJvvjdIz9D2z1jkMOtD/36ddaLFMtQd9xIk0jAaDP1TH/lEHvvUPwot6asMGMGkH9EgBPT+4eaYC77BGQBPOASweQZE5KDF8BeN/c0sLfSw='})
        print(r1.json())
    def test_wdjk_10(self):
        r1 = requests.post(url=Wdjk.case_hj+'health/doctor/v1/login',
                           params={'email':'2306398720@qq.com', 'pwd':'lZjdXyj15cOhn1a0yJKsW7o+fw/ogBDzn6CcyPSJUVIMmCPtCs+zuPwh7IZkXZiRhJvvjdIz9D2z1jkMOtD/36ddaLFMtQd9xIk0jAaDP1TH/lEHvvUPwot6asMGMGkH9EgBPT+4eaYC77BGQBPOASweQZE5KDF8BeN/c0sLfSw=','page':1})
        print(r1.json())


if __name__ == '__main__':
    unittest.main()
